package datastructure.queue;

import datastructure.list.DuLinkedList;
import datastructure.list.List;

/**
 * DESCRIPTION: 队列
 * 先进先出
 * rear 队尾，只能从队尾添加元素，一般叫做 enQueue，入队
 * front 队头，只能从队头移除元素，一般叫做 deQueue，出队
 * 先进先出原则，First In First Out，FIFO
 * Author: ammar
 * Date:   2021/12/15
 * Time:   下午1:30
 */
public class Queue<E> {
    private List<E> list = new DuLinkedList<>();
    public int Size() {
        return list.size();
    }

    public boolean isEmpty() {
        return list.isEmpty();
    }

    public void enQueue(E element) {
        list.add(element);
    }

    public E deQueue() {
        return list.remove(0);
    }


    public E front() {
        return list.get(0);
    }

    public void clear() {
        list.clear();
    }

}
